#include "LightMatch.hpp"

int main(int argc, char* argv[]) {
    cv::VideoCapture cap;
    std::string path = "/home/lenovo/_gitee/code_files/tasks/Judge/video2.avi";
    cap.open(path);
    if (cap.isOpened() == false) {
        std::cerr << "Failed to load video from '" << path << "'\n";
        return -1;
    }
    LightMatch mch;
    mch.setEnemyColor(true);
    cv::Mat frame;
    std::vector<int> labels;
    cv::namedWindow("disp", cv::WINDOW_AUTOSIZE);
    int frame_cnt = 0;
    while (true) {
        cap.read(frame);
        if (frame.empty()) break;
        // if (!isLowExposure(frame)) continue;
        printf("Frame %d started.\n", frame_cnt ++);
        mch.saveImg(frame);
        mch.findPossible();
        std::vector<int> cars(mch.possibles.size());
        for (size_t i = 0; i < cars.size(); i++) {
            cars[i] = 1;
        }
        std::vector<aim_deps::Armor> tar_list;
        mch.drawLights(frame);
        cv::imshow("disp", frame);
        cv::waitKey(10);
        
    }
    cv::destroyAllWindows();
    cap.release();
    return 0;
}